package com.xulu.romance.exception;

import com.xulu.romance.constants.Constant;
import com.xulu.romance.utils.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(RomanceException.class)
    @ResponseBody
    public R handle(RomanceException romanceException){
            return R.error(romanceException.getCode(),romanceException.getMsg());
    }

}
